package xuexi;


interface IWork{
    public void work();
}
class WorkImpl implements IWork{        //真实主题类

    @Override
    public void work() {
        System.out.println("[真实主题]  3：我在工作!");
    }
}

class ProxyImpl implements IWork{

    private IWork iWork;
    public ProxyImpl(IWork iWork){          //代理项
        this.iWork=iWork;
    }
    @Override
    public void work() {
        this.readyWork();
        this.iWork.work();
        this.outWork();
    }
    public void readyWork(){
        System.out.println("[代理主题]  1:坐公交车!");
        System.out.println("[代理主题]  2:打卡.开电脑!");
    }
    public void outWork(){
        System.out.println("[代理主题]  4:下班走人!");
    }
}
public class ProxyTest {
    public static void main(String[] args){
        IWork iWork=new ProxyImpl(new WorkImpl());
        iWork.work();
    }
}
